package com.hxzon.project;

import java.util.Collection;
import java.util.List;

public interface EDao<M> {
	public Object query(String hql, long first, long size);

	public Object query(String hql);

	// delete
	public void delete(M model);

	public void delete(String id);

	public void deleteAll();

	public void deleteAll(Collection<M> models);

	// save
	public void save(M model);

	public void saveAll(Collection<M> models);
	
	public void add(M model);

	public void addAll(Collection<M> models);
	
	public void update(M model);

	public void updateAll(Collection<M> models);

	// get
	public M get(String id);

	public M get(String fieldName, Object fieldValue);

	// all
	public List<M> getAll();

	public List<M> getAll(long first, long size);

	public List<M> getAll(long first, long size, String orderBy);

	public long countAll();

	// list
	public List<M> getList(String whereAndOrderBy);

	public List<M> getList(String whereAndOrderBy, long first, long size);

	public long countList(String whereAndOrderBy);

	public List<M> getList(String fieldName, Object fieldValue, long first, long size);

	public long countList(String fieldName, Object fieldValue);

	// like
	public List<M> getLike(String like, List<String> fields, long first, long size);

	public List<M> getLike(String like, long first, long size);

	public List<M> getLike(M example, List<String> fields, long first, long size);

	public List<M> getLike(M example, long first, long size);

	public long countLike(String like, List<String> fields);

	public long countLike(String like);

	public long countLike(M example, List<String> fields);

	public long countLike(M example);
}
